package com.atguigu.executorpool;

import java.util.LinkedList;

/**
 * @program: IDEAcode
 * @description:
 * @author: Mr.zjx
 * create: 2021-07-31-22-37
 **/
public class LInkedlistTest {
    public static void main(String[] args) {
        //队列
        LinkedList<String> ls = new LinkedList<String>();
        ls.add("b");
        ls.add("c");
        ls.add("d");
        ls.add("e");
        //队列，数据先进先出
        /*while (!ls.isEmpty()){
            String first = ls.removeFirst();//移除，返回被删除元素
            System.out.println(s);
        }*/
        //堆栈，先进后出
        while (!ls.isEmpty()){
            String last = ls.removeLast();
            System.out.println(last);
        }
        ls.addFirst("a");
        ls.addFirst("b");
        ls.addLast("c");
        String first = ls.getFirst();
        System.out.println(first);
    }
}
